package educationaladministrationsystem.CSM.Mapper.StudentAndTeacher.Certification;

import educationaladministrationsystem.Class.MajorProgram;
import educationaladministrationsystem.Class.Student;
import educationaladministrationsystem.Class.Teacher;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CertificationMapper {
    @Select("select * from MajorProgram")
    List<MajorProgram> getAllProfessionMajor();

    @Select("select facultiesId from majorprogram where id=#{id}")
    String getFacultiesIdByMajorProgramId(String id);

    @Select("select count(*) from student where id like concat('___',#{id},'___')")
    int getMajorNums(String id);


    @Insert("insert into student values (#{id},#{name},#{gender},#{birthday},#{location},#{email},#{idCard},#{facultiesId},#{majorProgramId},#{degreeId},#{enrollmentDate})")
    void uploadStudentCertification(Student student);

    @Select("select count(*) from teacher")
    int getTeacherNum();

    @Insert("insert into teacher values (#{id},#{name},#{gender},#{birthday},#{location},#{email},#{idCard},#{employmentDate},1)")
    void uploadTeacherCertification(Teacher teacher);
}
